package com.changgou.order.listener;

import com.changgou.order.service.OrderService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class OrderTimeOutListener {

    @Autowired
    private OrderService orderService;

    @RabbitListener(queues = "queue.ordertimeout")
    public void receiveCloseOrderMessage(String orderId){
        System.out.println("关闭订单队列收到消息： "+orderId);

        //根据订单id查询微信订单状态
        try{
            orderService.closeOrder(orderId);
        }catch(Exception e){

        }


    }
}
